﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HA.ModFlow.Infrastructure;

namespace HA.ModFlow.Domain.DomainLayer
{
    public static class UnitConverter
    {
        //public static string GetTime(TIME type)
        //{
        //    switch (type)
        //    {
        //        case TIME.SECOND:
        //            return "s";
        //        case TIME.MINUTE:
        //            return "min";
        //        case TIME.HOUR:
        //            return "h";
        //        case TIME.DAY:
        //            return "d";
        //        case TIME.YEAR:
        //            return "yr";
        //        default:
        //            throw new InvalidCastException();
        //    }
        //}


        //public static string GetLength(LENGTH type)
        //{
        //    switch (type)
        //    {
        //        case LENGTH.FT:
        //            return "ft";
        //        case LENGTH.M:
        //            return "m";
        //        case LENGTH.CM:
        //            return "cm";
        //        default:
        //            throw new InvalidCastException();
        //    }
        //}

        public static string GetTime(TIME type)
        {
            switch (type)
            {
                case TIME.SECOND:
                    return "s";
                case TIME.MINUTE:
                    return "min";
                case TIME.HOUR:
                    return "h";
                case TIME.DAY:
                    return "d";
                case TIME.YEAR:
                    return "yr";
                default:
                    throw new InvalidCastException();
            }
        }

        public static string GetMass(MASS type)
        {
            switch (type)
            {
                case MASS.MG:
                    return "mg";
                case MASS.G:
                    return "g";
                case MASS.KG:
                    return "kg";
                case MASS.SLUG:
                    return "slug";
                default:
                    throw new InvalidCastException();
            }
        }

        public static string GetConcentration(Units units)
        {
            switch (units.Concentration)
            {
                case CONCENTRATION.GPerL:
                    return "g/l";
                case CONCENTRATION.MgPerL:
                    return "mg/l";
                case CONCENTRATION.PPM:
                    return "ppm";
                case CONCENTRATION.PPB:
                    return "ppb";
                case CONCENTRATION.PPT:
                    return "ppt";
                case CONCENTRATION.MASSPerLenth3:

                    if (units == null)
                        throw new NullReferenceException();

                    return GetMass(units.Mass) + "/" + GetLength(units.Length) + "^3";
                default:
                    throw new InvalidCastException();
            }
        }

        public static string GetLength(LENGTH type)
        {
            switch (type)
            {
                case LENGTH.FT:
                    return "ft";
                case LENGTH.M:
                    return "m";
                case LENGTH.CM:
                    return "cm";
                default:
                    throw new InvalidCastException();
            }
        }


    }
}
